<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ (c) 2018 Open Source Geospatial Foundation - all rights reserved
  ~ This code is licensed under the GPL 2.0 license, available at the root
  ~ application directory.
  ~
  -->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:sec="http://www.springframework.org/schema/security" xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security-3.0.4.xsd
          http://www.springframework.org/schema/security/oauth2
          http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd">

	<bean id="geonodeOauth2Extension" class="org.geoserver.platform.ModuleStatusImpl">
		<constructor-arg index="0" value="gs-sec-oauth2-geonode" />
		<constructor-arg index="1" value="GeoServer Security OAuth2 GeoNode" />
	</bean>

	<!-- OAuth2 Security Extension -->
		<bean id="geoNodeOAuth2TokenServices" class="org.geoserver.security.oauth2.services.GeoNodeTokenServices">

		</bean>

		<bean id="geoNodeOAuth2AuthenticationProvider"
			class="org.geoserver.security.oauth2.GeoNodeOAuth2AuthenticationProvider">
			<constructor-arg ref="authenticationManager" />
			<constructor-arg value="geoNodeOAuth2TokenServices" />
			<constructor-arg value="geoNodeOAuth2SecurityConfiguration" />
			<constructor-arg value="geoNodeOauth2RestTemplate" />
		</bean>

		<!-- wicket ui stuff -->
	
		<!-- ui auth provider panel info -->
		<bean id="geoNodeOAuth2AuthPanelInfo"
			class="org.geoserver.web.security.oauth2.GeoNodeOAuth2AuthProviderPanelInfo">
			<property name="id" value="security.GeoNodeOAuth2AuthProvider" />
			<property name="shortTitleKey" value="GeoNodeOAuth2AuthProviderPanel.short" />
			<property name="titleKey" value="GeoNodeOAuth2AuthProviderPanel.title" />
			<property name="descriptionKey" value="GeoNodeOAuth2AuthProviderPanel.description" />
		</bean>

		<!-- login button -->
	 	<bean id="geonodeFormLoginButton" class="org.geoserver.web.LoginFormInfo">
	 		<property name="id" value="geonodeFormLoginButton" />
	 		<!-- property name="titleKey" value="GeoNodeOAuth2AuthProviderPanel.login" / -->
	 		<property name="titleKey" value="" />
	 		<property name="descriptionKey" value="GeoNodeOAuth2AuthProviderPanel.description" />
	 		<property name="componentClass" value="org.geoserver.web.security.oauth2.GeoNodeOAuth2AuthProviderPanel" />
	 		<property name="name" value="geonode" />
	 		<property name="icon" value="geonode.png" />
	 		<property name="filterClass" value="org.geoserver.security.oauth2.GeoNodeOAuthAuthenticationFilter" />
	 		<property name="loginPath" value="web/j_spring_oauth2_geonode_login" />
	 	</bean>

</beans>
